<template>
  <div>
    <div class="flex items-start justify-between">
      <div>
        <el-col>
          <el-row>
            <span class="text-xl font-bold">{{ stock.stockName }}</span>
          </el-row>
        </el-col>
      </div>
      <div>
        <!-- 右上：按钮 -->
        <el-button v-if="stock.stockStatus === 1" @click="openForm('update', stock.id)" v-hasPermi="['crm:product:update']">
          编辑
        </el-button>
      </div>
    </div>
  </div>
  <ContentWrap class="mt-10px">
    <el-descriptions :column="4" >
      <el-descriptions-item label="备货编码">{{ stock.stockNo }}</el-descriptions-item>
      <el-descriptions-item label="备货单名称">{{ stock.stockName }}</el-descriptions-item>
      <el-descriptions-item label="下单部门">{{ stock.deptName }}</el-descriptions-item>
      <el-descriptions-item label="下单人">{{ stock.signUserName }}</el-descriptions-item>
      <el-descriptions-item label="完成时间">{{ stock.finishTime }}</el-descriptions-item>
      <el-descriptions-item label="客户名称">{{ stock.customerName }}</el-descriptions-item>
      <el-descriptions-item label="品牌名称">{{ stock.brandName }}</el-descriptions-item>
      <el-descriptions-item label="门店名称">{{ stock.storeName }}</el-descriptions-item>
      <el-descriptions-item label="产品种类数量">{{ stock.productCount }}</el-descriptions-item>
      <el-descriptions-item label="备货单类型">
        <dict-tag :type="DICT_TYPE.CRM_STOCK_TYPE" :value="stock.stockType" />
      </el-descriptions-item>
      <el-descriptions-item label="备货单状态">
        <dict-tag :type="DICT_TYPE.CRM_STOCK_STATUS" :value="stock.stockStatus" />
      </el-descriptions-item>
    </el-descriptions>
    <el-descriptions :column="4" >
      <el-descriptions-item label="备货单Excel">{{ stock.fileUrls }}</el-descriptions-item>
    </el-descriptions>
  </ContentWrap>
  <!-- 表单弹窗：添加/修改 -->
  <!-- 表单弹窗：添加/修改 -->
  <StockProductForm ref="formRef" @success="getList" />
</template>
<script setup lang="ts">
import StockProductForm from '@/views/crm/stockproduct/StockProductForm.vue'
import { DICT_TYPE } from '@/utils/dict'
import { StockProductApi, StockProduct } from '@/api/crm/stockproduct'

// 操作修改
const formRef = ref()
const openForm = (type: string, id?: number) => {
  formRef.value.open(type, id)
}
const { stock } = defineProps<{ stock: StockProduct }>()
</script>
